#!/bin/sh /etc/rc.common                             

START=17                                             

start() {                                            
  OLDMAC=$(uci get network.wan.macaddr)              
  logger "[WAN-MAC] Old WAN MAC address is ${OLDMAC}."                                                    
  NEWMAC=$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/')                                                                            
  logger "[WAN-MAC] Applying new random MAC address to WAN (${NEWMAC})..."                                
  uci set network.wan.macaddr=${NEWMAC}              
  uci commit network                                 
}                                                    
